
export const IEventTypeNone = Symbol("none");
export const IEventTypeChange = Symbol("change");
export const IEventTypeMouseDown = Symbol("mousedown");
export const IEventTypeMouseMove = Symbol("mousemove");
export const IEventTypeMouseUp = Symbol("mouseup");
export const IEventTypeMouseWheel = Symbol("mousewheel");
export const IEventTypeClick = Symbol("click");
export const IEventTypeContextMenu = Symbol("contextmenu");
export const IEventTypeKeyDown = Symbol("keydown");
export const IEventTypeKeyUp = Symbol("keyup");
export const IEventTypeTextInput = Symbol("textinput");

export const MOUSE_BUTTON_NONE = Symbol("none");
export const MOUSE_BUTTON_LEFT = Symbol("left");
export const MOUSE_BUTTON_RIGHT = Symbol("right");
export const MOUSE_BUTTON_MIDDLE = Symbol("middle");

export const MOUSE_BUTTON = {
    LEFT: MOUSE_BUTTON_LEFT,
    RIGHT: MOUSE_BUTTON_RIGHT,
    MIDDLE: MOUSE_BUTTON_MIDDLE,
    NONE: MOUSE_BUTTON_NONE
}

// 事件: 是指用户与界面交互时触发的动作, 如鼠标点击， 键盘输入等。
// 流程： 用户操作 -> 获取事件元素链 -> 事件对象创建 -> 事件分发(捕获与冒泡) -> 事件处理函数执行
export class IEvent {
    constructor() {
        this.m_type = IEventTypeNone;
        this.m_name = "none";
        this.m_timestamp = 0;
        this.m_stop_propagation = false; // 停止传播 中断事件后续处理
        this.m_prevent_default = false;  // 阻止默认行为
        this.m_stop_capture = false;     // 停止捕获
        this.m_stop_bubble = false;      // 停止冒泡
        this.m_target_element = null;    // 目标事件元素
        this.m_event_elements = [];      // 事件元素链
    }
    SetType(type) { this.m_type = type; }
    GetType() { return this.m_type; }
    SetName(name) { this.m_name = name; }
    GetName() { return this.m_name; }
    SetTimeStamp(timestamp) { this.m_timestamp = timestamp; }
    GetTimeStamp() { return this.m_timestamp; }
    IsMouseEvent() { return this.m_type === IEventTypeMouseDown || this.m_type === IEventTypeMouseMove || this.m_type === IEventTypeMouseUp || this.m_type === IEventTypeMouseWheel; }
    IsMouseDownEvent() { return this.m_type === IEventTypeMouseDown; }
    IsMouseMoveEvent() { return this.m_type === IEventTypeMouseMove; }
    IsMouseUpEvent() { return this.m_type === IEventTypeMouseUp; }
    IsMouseWheelEvent() { return this.m_type === IEventTypeMouseWheel; }
    IsKeyEvent() { return this.m_type === IEventTypeKeyDown || this.m_type === IEventTypeKeyUp; }
    IsKeyDownEvent() { return this.m_type === IEventTypeKeyDown; }
    IsKeyUpEvent() { return this.m_type === IEventTypeKeyUp; }
    IsTextInputEvent() { return this.m_type === IEventTypeTextInput; }

    // 停止捕获
    IsStopCapture() { return this.m_stop_capture; }
    StopCapture() { this.m_stop_capture = true; }
    EnableCapture() { this.m_stop_capture = false; }
    // 停止冒泡
    IsStopBubble() { return this.m_stop_bubble; }
    StopBubble() { this.m_stop_bubble = true; }
    EnableBubble() { this.m_stop_bubble = false; }
    // 停止传播
    IsStopPropagation() { return this.m_stop_propagation; }
    StopPropagation() { this.m_stop_propagation = true; }
    EnablePropagation() { this.m_stop_propagation = false; }
    // 阻止默认行为
    IsPreventDefault() { return this.m_prevent_default; }
    PreventDefault() { this.m_prevent_default = true; }
    EnableDefault() { this.m_prevent_default = false; }
    // 设置目标事件元素
    SetTargetElement(element) { this.m_target_element = element; }
    GetTargetElement() { return this.m_target_element; }
    PushEventElement(element) { this.m_event_elements.push(element); }
    SetEventElements(event_elements) { this.m_event_elements = event_elements; }
    GetEventElements() { return this.m_event_elements; }
}

export class IEventChange extends IEvent {
    constructor() {
        super();
        this.SetType(IEventTypeChange);
        this.SetName("change");
    }
    SetValue(value) { this.m_value = value; }
    GetValue() { return this.m_value; }
}

export class IEventMouse extends IEvent {
    constructor() {
        super();
        this.m_x = 0;
        this.m_y = 0;
        this.m_button = MOUSE_BUTTON_NONE;
        this.m_left_button_pressed = false;
        this.m_right_button_pressed = false;
        this.m_dragging = false;
        this.m_mouse_down_x = 0;
        this.m_mouse_down_y = 0;
        this.m_mouse_down_timestamp = 0;
    }

    SetXY(x, y) {
        this.m_x = x;
        this.m_y = y;
    }
    SetMouseDownXY(x, y) {
        this.m_mouse_down_x = x;
        this.m_mouse_down_y = y;
    }
    GetX() { return this.m_x; }
    GetY() { return this.m_y; }
    GetButton() { return this.m_button; }
    SetButton(button) { this.m_button = button; }
    IsLeftButton() { return this.m_button == MOUSE_BUTTON_LEFT; }
    IsRightButton() { return this.m_button == MOUSE_BUTTON_RIGHT; }
    IsLeftButtonPressed() { return this.m_left_button_pressed; }
    SetLeftButtonPressed(pressed) { this.m_left_button_pressed = pressed; }
    IsRightButtonPressed() { return this.m_right_button_pressed; }
    SetRightButtonPressed(pressed) { this.m_right_button_pressed = pressed; }
    IsDragging() { return this.m_dragging; }
    SetDragging(dragging) { this.m_dragging = dragging; }
    GetMouseDownX() { return this.m_mouse_down_x; }
    GetMouseDownY() { return this.m_mouse_down_y; }
    SetMouseDownTimeStamp(timestamp) { this.m_mouse_down_timestamp = timestamp; }
    GetMouseDownTimeStamp() { return this.m_mouse_down_timestamp; }
}

export class IEventMouseDown extends IEventMouse {
    constructor() {
        super();
        this.SetType(IEventTypeMouseDown);
        this.SetName("mousedown");
    }
}

export class IEventMouseMove extends IEventMouse {
    constructor() {
        super();
        this.SetType(IEventTypeMouseMove);
        this.SetName("mousemove");
    }
}

export class IEventMouseUp extends IEventMouse {
    constructor() {
        super();
        this.SetType(IEventTypeMouseUp);
        this.SetName("mouseup");
    }
}

export class IEventMouseWheel extends IEventMouse {
    constructor() {
        super();
        this.m_delta = 0;
        this.SetType(IEventTypeMouseWheel);
        this.SetName("mousewheel");
    }
    SetDelta(delta) { this.m_delta = delta; }
    GetDelta() { return this.m_delta; }
}

export class IEventClick extends IEventMouse {
    constructor() {
        super();
        this.SetType(IEventTypeClick);
        this.SetName("click");
    }
}

export class IEventContextMenu extends IEventMouse {
    constructor() {
        super();
        this.SetType(IEventTypeContextMenu);
        this.SetName("contextmenu");
    }
}

export const KEYCODE_UNKNOWN = Symbol("unknown");
export const KEYCODE_0 = Symbol("0");
export const KEYCODE_1 = Symbol("1");
export const KEYCODE_2 = Symbol("2");
export const KEYCODE_3 = Symbol("3");
export const KEYCODE_4 = Symbol("4");
export const KEYCODE_5 = Symbol("5");
export const KEYCODE_6 = Symbol("6");
export const KEYCODE_7 = Symbol("7");
export const KEYCODE_8 = Symbol("8");
export const KEYCODE_9 = Symbol("9");
export const KEYCODE_NUMPAD0 = Symbol("numpad0");
export const KEYCODE_NUMPAD1 = Symbol("numpad1");
export const KEYCODE_NUMPAD2 = Symbol("numpad2");
export const KEYCODE_NUMPAD3 = Symbol("numpad3");
export const KEYCODE_NUMPAD4 = Symbol("numpad4");
export const KEYCODE_NUMPAD5 = Symbol("numpad5");
export const KEYCODE_NUMPAD6 = Symbol("numpad6");
export const KEYCODE_NUMPAD7 = Symbol("numpad7");
export const KEYCODE_NUMPAD8 = Symbol("numpad8");
export const KEYCODE_NUMPAD9 = Symbol("numpad9");
export const KEYCODE_A = Symbol("A");
export const KEYCODE_B = Symbol("B");
export const KEYCODE_C = Symbol("C");
export const KEYCODE_D = Symbol("D");
export const KEYCODE_E = Symbol("E");
export const KEYCODE_F = Symbol("F");
export const KEYCODE_G = Symbol("G");
export const KEYCODE_H = Symbol("H");
export const KEYCODE_I = Symbol("I");
export const KEYCODE_J = Symbol("J");
export const KEYCODE_K = Symbol("K");
export const KEYCODE_L = Symbol("L");
export const KEYCODE_M = Symbol("M");
export const KEYCODE_N = Symbol("N");
export const KEYCODE_O = Symbol("O");
export const KEYCODE_P = Symbol("P");
export const KEYCODE_Q = Symbol("Q");
export const KEYCODE_R = Symbol("R");
export const KEYCODE_S = Symbol("S");
export const KEYCODE_T = Symbol("T");
export const KEYCODE_U = Symbol("U");
export const KEYCODE_V = Symbol("V");
export const KEYCODE_W = Symbol("W");
export const KEYCODE_X = Symbol("X");
export const KEYCODE_Y = Symbol("Y");
export const KEYCODE_Z = Symbol("Z");
export const KEYCODE_F1 = Symbol("F1");
export const KEYCODE_F2 = Symbol("F2");
export const KEYCODE_F3 = Symbol("F3");
export const KEYCODE_F4 = Symbol("F4");
export const KEYCODE_F5 = Symbol("F5");
export const KEYCODE_F6 = Symbol("F6");
export const KEYCODE_F7 = Symbol("F7");
export const KEYCODE_F8 = Symbol("F8");
export const KEYCODE_F9 = Symbol("F9");
export const KEYCODE_F10 = Symbol("F10");
export const KEYCODE_F11 = Symbol("F11");
export const KEYCODE_F12 = Symbol("F12");
export const KEYCODE_RIGHT = Symbol("RIGHT");
export const KEYCODE_LEFT = Symbol("LEFT");
export const KEYCODE_DOWN = Symbol("DOWN");
export const KEYCODE_UP = Symbol("UP");
export const KEYCODE_LCONTROL = Symbol("LCONTROL");
export const KEYCODE_RCONTROL = Symbol("RCONTROL");
export const KEYCODE_LALT = Symbol("LALT");
export const KEYCODE_RALT = Symbol("RALT");
export const KEYCODE_LSHIFT = Symbol("LSHIFT");
export const KEYCODE_RSHIFT = Symbol("RSHIFT");
export const KEYCODE_LGUI = Symbol("LGUI");
export const KEYCODE_RGUI = Symbol("RGUI");
export const KEYCODE_RMENU = Symbol("RMENU");
export const KEYCODE_INSERT = Symbol("INSERT");
export const KEYCODE_HOME = Symbol("HOME");
export const KEYCODE_DELETE = Symbol("DELETE");
export const KEYCODE_END = Symbol("END");
export const KEYCODE_PAGEUP = Symbol("PAGEUP");
export const KEYCODE_PAGEDOWN = Symbol("PAGEDOWN");
export const KEYCODE_CAPSLOCK = Symbol("CAPSLOCK");
export const KEYCODE_PAUSE = Symbol("PAUSE");
export const KEYCODE_SPACE = Symbol("SPACE");
export const KEYCODE_RETURN = Symbol("RETURN");
export const KEYCODE_ESCAPE = Symbol("ESCAPE");
export const KEYCODE_BACKSPACE = Symbol("BACKSPACE");
export const KEYCODE_TAB = Symbol("TAB");
export const KEYCODE_EXCLAIM = Symbol("EXCLAIM"); // '!'
export const KEYCODE_DBLAPOSTROPHE = Symbol("DBLAPOSTROPHE"); // '"'
export const KEYCODE_HASH = Symbol("HASH"); // '#'
export const KEYCODE_PERCENT = Symbol("PERCENT"); // '%',
export const KEYCODE_DOLLAR = Symbol("DOLLAR"); // '$'
export const KEYCODE_AMPERSAND = Symbol("AMPERSAND"); // '&',
export const KEYCODE_APOSTROPHE = Symbol("APOSTROPHE"); // '\''
export const KEYCODE_LEFTPAREN = Symbol("LEFTPAREN"); // '(',
export const KEYCODE_RIGHTPAREN = Symbol("RIGHTPAREN"); // ')',
export const KEYCODE_ASTERISK = Symbol("ASTERISK"); // '*',
export const KEYCODE_PLUS = Symbol("PLUS"); // '+'
export const KEYCODE_COMMA = Symbol("COMMA"); // ','
export const KEYCODE_MINUS = Symbol("MINUS"); // '-'
export const KEYCODE_PERIOD = Symbol("PERIOD"); // '.'
export const KEYCODE_SLASH = Symbol("SLASH"); // '/'
export const KEYCODE_UNDERSCORE = Symbol("UNDERSCORE"); // '_',
export const KEYCODE_QUESTION = Symbol("QUESTION"); // '?',
export const KEYCODE_LESS = Symbol("LESS"); // '<'
export const KEYCODE_GREATER = Symbol("GREATER"); // '>',
export const KEYCODE_COLON = Symbol("COLON"); // ':'
export const KEYCODE_CARET = Symbol("CARET"); // '^',
export const KEYCODE_AT = Symbol("AT"); // '@'
export const KEYCODE_SEMICOLON = Symbol("SEMICOLON"); // ';'
export const KEYCODE_RIGHTBRACKET = Symbol("RIGHTBRACKET"); // ']'
export const KEYCODE_LEFTBRACKET = Symbol("LEFTBRACKET"); // '['
export const KEYCODE_BACKSLASH = Symbol("BACKSLASH"); // '\\'
export const KEYCODE_NUMPAD_PLUS = Symbol("NUMPAD_PLUS"); // '+'
export const KEYCODE_NUMPAD_MINUS = Symbol("NUMPAD_MINUS"); // '-'
export const KEYCODE_NUMPAD_MULTIPLY = Symbol("NUMPAD_MULTIPLY"); // '*'
export const KEYCODE_NUMPAD_DIVIDE = Symbol("NUMPAD_DIVIDE"); // '/'
export const KEYCODE_NUMPAD_PERIOD = Symbol("NUMPAD_PERIOD"); // '.'
export const KEYCODE_NUMPAD_ENTER = Symbol("NUMPAD_ENTER"); // '\n'
export const KEYCODE_GRAVE = Symbol("GRAVE"); // '`'
export const KEYCODE_EQUALS = Symbol("EQUALS"); // '='
export const KEYCODE_NUMLOCKCLEAR = Symbol("NUMLOCKCLEAR");

export class IEventKey extends IEvent {
    constructor() {
        super();
        this.m_keycode = 0;
        this.m_ctrl_pressed = false;
        this.m_shift_pressed = false;
        this.m_alt_pressed = false;
    }
    SetKeyCode(keycode) { this.m_keycode = keycode; }
    GetKeyCode() { return this.m_keycode; }
    SetCtrlPressed(pressed) { this.m_ctrl_pressed = pressed; }
    IsCtrlPressed() { return this.m_ctrl_pressed; }
    SetShiftPressed(pressed) { this.m_shift_pressed = pressed; }
    IsShiftPressed() { return this.m_shift_pressed; }
    SetAltPressed(pressed) { this.m_alt_pressed = pressed; }
    IsAltPressed() { return this.m_alt_pressed; }

    IsEnter() { return this.m_keycode == KEYCODE_RETURN || this.m_keycode == KEYCODE_NUMPAD_ENTER; }
    IsDelete() { return this.m_keycode == KEYCODE_DELETE; }
    IsBackSpace() { return this.m_keycode == KEYCODE_BACKSPACE; }
    IsTab() { return this.m_keycode == KEYCODE_TAB; }
    IsCtrl() { return this.m_keycode == KEYCODE_LCONTROL || this.m_keycode == KEYCODE_RCONTROL; }
    IsShift() { return this.m_keycode == KEYCODE_LSHIFT || this.m_keycode == KEYCODE_RSHIFT; }
    IsAlt() { return this.m_keycode == KEYCODE_LALT || this.m_keycode == KEYCODE_RALT; }
    IsLeft() { return this.m_keycode == KEYCODE_LEFT; }
    IsRight() { return this.m_keycode == KEYCODE_RIGHT; }
    IsUp() { return this.m_keycode == KEYCODE_UP; }
    IsDown() { return this.m_keycode == KEYCODE_DOWN; }
    IsHome() { return this.m_keycode == KEYCODE_HOME; }
    IsEnd() { return this.m_keycode == KEYCODE_END; }
    IsPageUp() { return this.m_keycode == KEYCODE_PAGEUP; }
    IsPageDown() { return this.m_keycode == KEYCODE_PAGEDOWN; }

    // ctrl + c, v, x, z, y, a
    IsCtrlC() { return this.m_ctrl_pressed && this.m_keycode == KEYCODE_C; }
    IsCtrlV() { return this.m_ctrl_pressed && this.m_keycode == KEYCODE_V; }
    IsCtrlX() { return this.m_ctrl_pressed && this.m_keycode == KEYCODE_X; }
    IsCtrlZ() { return this.m_ctrl_pressed && this.m_keycode == KEYCODE_Z; }
    IsCtrlY() { return this.m_ctrl_pressed && this.m_keycode == KEYCODE_Y; }
    IsCtrlA() { return this.m_ctrl_pressed && this.m_keycode == KEYCODE_A; }
    IsCtrlS() { return this.m_ctrl_pressed && this.m_keycode == KEYCODE_S; }

    // shift + left, right, up, down, home, end, pageup, pagedown
    IsShiftLeft() { return this.m_shift_pressed && this.m_keycode == KEYCODE_LEFT; }
    IsShiftRight() { return this.m_shift_pressed && this.m_keycode == KEYCODE_RIGHT; }
    IsShiftUp() { return this.m_shift_pressed && this.m_keycode == KEYCODE_UP; }
    IsShiftDown() { return this.m_shift_pressed && this.m_keycode == KEYCODE_DOWN; }
    IsShiftHome() { return this.m_shift_pressed && this.m_keycode == KEYCODE_HOME; }
    IsShiftEnd() { return this.m_shift_pressed && this.m_keycode == KEYCODE_END; }
    IsShiftPageUp() { return this.m_shift_pressed && this.m_keycode == KEYCODE_PAGEUP; }
    IsShiftPageDown() { return this.m_shift_pressed && this.m_keycode == KEYCODE_PAGEDOWN; }
}

export class IEventKeyDown extends IEventKey {
    constructor(keycode) {
        super();
        this.SetKeyCode(keycode);
        this.SetType(IEventTypeKeyDown);
    }
}

export class IEventKeyUp extends IEventKey {
    constructor(keycode) {
        super();
        this.SetKeyCode(keycode);
        this.SetType(IEventTypeKeyUp);
    }
}

const keycode_map = {
    // 数字键 0-9
    48: KEYCODE_0,   // '0'
    49: KEYCODE_1,   // '1'
    50: KEYCODE_2,   // '2'
    51: KEYCODE_3,   // '3'
    52: KEYCODE_4,   // '4'
    53: KEYCODE_5,   // '5'
    54: KEYCODE_6,   // '6'
    55: KEYCODE_7,   // '7'
    56: KEYCODE_8,   // '8'
    57: KEYCODE_9,   // '9'

    // 字母键 A-Z (注意: keyCode不区分大小写)
    65: KEYCODE_A,   // 'A'
    66: KEYCODE_B,   // 'B'
    67: KEYCODE_C,   // 'C'
    68: KEYCODE_D,   // 'D'
    69: KEYCODE_E,   // 'E'
    70: KEYCODE_F,   // 'F'
    71: KEYCODE_G,   // 'G'
    72: KEYCODE_H,   // 'H'
    73: KEYCODE_I,   // 'I'
    74: KEYCODE_J,   // 'J'
    75: KEYCODE_K,   // 'K'
    76: KEYCODE_L,   // 'L'
    77: KEYCODE_M,   // 'M'
    78: KEYCODE_N,   // 'N'
    79: KEYCODE_O,   // 'O'
    80: KEYCODE_P,   // 'P'
    81: KEYCODE_Q,   // 'Q'
    82: KEYCODE_R,   // 'R'
    83: KEYCODE_S,   // 'S'
    84: KEYCODE_T,   // 'T'
    85: KEYCODE_U,   // 'U'
    86: KEYCODE_V,   // 'V'
    87: KEYCODE_W,   // 'W'
    88: KEYCODE_X,   // 'X'
    89: KEYCODE_Y,   // 'Y'
    90: KEYCODE_Z,   // 'Z'

    // 数字小键盘 0-9
    96: KEYCODE_NUMPAD0,   // numpad '0'
    97: KEYCODE_NUMPAD1,   // numpad '1'
    98: KEYCODE_NUMPAD2,   // numpad '2'
    99: KEYCODE_NUMPAD3,   // numpad '3'
    100: KEYCODE_NUMPAD4,  // numpad '4'
    101: KEYCODE_NUMPAD5,  // numpad '5'
    102: KEYCODE_NUMPAD6,  // numpad '6'
    103: KEYCODE_NUMPAD7,  // numpad '7'
    104: KEYCODE_NUMPAD8,  // numpad '8'
    105: KEYCODE_NUMPAD9,  // numpad '9'

    // 功能键 F1-F12
    112: KEYCODE_F1,   // F1
    113: KEYCODE_F2,   // F2
    114: KEYCODE_F3,   // F3
    115: KEYCODE_F4,   // F4
    116: KEYCODE_F5,   // F5
    117: KEYCODE_F6,   // F6
    118: KEYCODE_F7,   // F7
    119: KEYCODE_F8,   // F8
    120: KEYCODE_F9,   // F9
    121: KEYCODE_F10,  // F10
    122: KEYCODE_F11,  // F11
    123: KEYCODE_F12,  // F12

    // 方向键
    37: KEYCODE_LEFT,   // 左箭头
    38: KEYCODE_UP,     // 上箭头
    39: KEYCODE_RIGHT,  // 右箭头
    40: KEYCODE_DOWN,   // 下箭头

    // 控制键
    16: KEYCODE_LSHIFT,    // 左 Shift
    17: KEYCODE_LCONTROL,  // 左 Ctrl
    18: KEYCODE_LALT,      // 左 Alt
    91: KEYCODE_LGUI,      // 左 GUI (Windows/Mac键)
    92: KEYCODE_RGUI,      // 右 GUI
    93: KEYCODE_RMENU,     // 右菜单键(部分键盘)

    // 特殊符号键
    32: KEYCODE_SPACE,      // 空格
    13: KEYCODE_RETURN,     // 回车
    27: KEYCODE_ESCAPE,     // ESC
    8: KEYCODE_BACKSPACE,  // 退格
    9: KEYCODE_TAB,        // Tab

    // 标点符号键
    188: KEYCODE_COMMA,     // ','
    190: KEYCODE_PERIOD,    // '.'
    191: KEYCODE_SLASH,     // '/'
    186: KEYCODE_SEMICOLON, // ';'
    222: KEYCODE_APOSTROPHE,// '''
    219: KEYCODE_LEFTBRACKET,  // '['
    221: KEYCODE_RIGHTBRACKET, // ']'
    220: KEYCODE_BACKSLASH,    // '\'
    192: KEYCODE_GRAVE,        // '`'
    187: KEYCODE_EQUALS,       // '='
    189: KEYCODE_MINUS,        // '-'

    // 小键盘特殊键
    106: KEYCODE_NUMPAD_MULTIPLY, // '*'
    107: KEYCODE_NUMPAD_PLUS,     // '+'
    109: KEYCODE_NUMPAD_MINUS,    // '-'
    111: KEYCODE_NUMPAD_DIVIDE,   // '/'
    110: KEYCODE_NUMPAD_PERIOD,   // '.'
    13: KEYCODE_NUMPAD_ENTER,    // 小键盘回车 (通常与主回车相同)

    // 其他特殊键
    45: KEYCODE_INSERT,     // Insert
    36: KEYCODE_HOME,       // Home
    46: KEYCODE_DELETE,     // Delete
    35: KEYCODE_END,        // End
    33: KEYCODE_PAGEUP,     // Page Up
    34: KEYCODE_PAGEDOWN,   // Page Down
    20: KEYCODE_CAPSLOCK,   // Caps Lock
    144: KEYCODE_NUMLOCKCLEAR, // Num Lock
    19: KEYCODE_PAUSE,      // Pause/Break
}

export function SetKeyCode(keyvalue, keycode) {
    keycode_map[keyvalue] = keycode;
}

export function GetKeyCode(keyvalue) {
    return keycode_map[keyvalue] || KEYCODE_UNKNOWN;
}
